#ifndef XMLTORECORDS_H
#define XMLTORECORDS_H

#include <QtXml>
#include <QJsonObject>
#include <QJsonArray>
class XmlToRecords
{
public:
    XmlToRecords();
    QList<QMap<QString, QString> > readFile(QString filename);
    QXmlStreamReader* my_reader_;

    void loadConfig(const QJsonObject &config_json);

    void getChildAttr(QMap<QString, QString> &parent_attr, QDomNode &node,QString tag, QJsonObject field_name);

    QList<QDomNode> nodePath(QDomNode node, QString Path);

    void appendAttr(const QDomNode &node, QJsonObject attr_field, QMap<QString, QString> &attr_list_);
    void findTargetNodesByTagPath(QList<QDomNode> &list, QString Path);
    bool lessBySortField(QMap<QString, QString> &attr_0, QMap<QString, QString> &attr_1);
private:
    QJsonObject parse_config_obj_;
    QString     target_tag_;
    QJsonObject key_attr_;
    QJsonArray  sort_field_array_;
    QDomElement doc_elem_;
};

#endif // XMLTORECORDS_H
